import 'package:flutter/cupertino.dart';

abstract class BaseStatefulPage extends StatefulWidget {
  const BaseStatefulPage({Key? key}) : super(key: key);
}

// state添加监听app生命周期
// 生命周期通过 didChangeAppLifecycleState 进行回调
abstract class BasePageState<T extends BaseStatefulPage> extends State<T>
    with WidgetsBindingObserver {
  @override
  void initState() {
    WidgetsBinding.instance?.addObserver(this);
    super.initState();
  }
  @override
  void dispose() {
    WidgetsBinding.instance?.removeObserver(this);
    super.dispose();
  }
}

abstract class BaseStatelessPage extends StatelessWidget {
  const BaseStatelessPage({Key? key}) : super(key: key);
}
